package com.clever.mall.controller;

import com.clever.mall.commons.result.BaseResult;
import com.clever.mall.service.CateGoryService;
import com.clever.mall.vo.CateGoryVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/category")
public class CateGoryController {
    @Resource
    CateGoryService cateGoryService;

    //查询热门分类的前8条
    @RequestMapping("/findHeatCategory")
    public BaseResult findHeatCategory(){
        List<CateGoryVo> heatCateGory = cateGoryService.findHeatCateGory();
        return BaseResult.success(heatCateGory);
    }

    //查询所有分类
    @RequestMapping("/findAllCateGory")
    public BaseResult findAllCateGory(){
        List<CateGoryVo> allCateGory = cateGoryService.findAllCateGory();
        return BaseResult.success(allCateGory);
    }
}
